﻿using System;

class MinAndMax
{
    static void Main()
    {
        //Exercise 3.
        //Write a program that reads from the console a sequence of N integer numbers and returns the minimal and maximal of them.

        Console.Write("Enter sequence N:  ");
        int sequence = int.Parse(Console.ReadLine());        

        Console.Write("Enter an integer number:  ");
        int startNumber = int.Parse(Console.ReadLine());
        int minNumber = startNumber;
        int maxNumber = startNumber;

        for (int i = 0; i < sequence-1; i++)
        {
            Console.Write("Enter an integer number:  ");            
            int number = int.Parse(Console.ReadLine());
            
            if (number > maxNumber)
            {
                maxNumber = number;
            }
            else if (number <= minNumber)
            {
                minNumber = number;
            }
        }
        Console.WriteLine();
        Console.WriteLine("Minimal number is:  {0}.", minNumber);
        Console.WriteLine("Maximal number is:  {0}.", maxNumber);
        Console.WriteLine();
    }
}